package com.zrrd.jt_admin.common.config;

import com.zrrd.jt_admin.common.interceptor.MyInttercetor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ZhangYK
 * @version 8.0
 * @title WebConfig
 * @description
 * @create 2024/6/28 23:16
 */
//@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Bean
    public MyInttercetor myInttercetor() {
        return new MyInttercetor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        MyInttercetor myInttercetor = myInttercetor();
        registry.addInterceptor(myInttercetor).addPathPatterns("/admin/**")
                .excludePathPatterns("/swagger-resources/**","/webjars/**", "/v2/**", "/swagger-ui.html/**","/swagger-resources/**",
                        "/api", "/api-docs", "/api-docs/**", "/doc.html/**","/admin/login");
    }
}
